<?php
/**
 * Created by JetBrains PhpStorm.
 * User: porterzhang
 * Date: 13-3-19 下午3:34
 * To change this template use File | Settings | File Templates.
 */
if (!defined('IN_MOBILE_API')) {
    exit('Access Denied');
}

include_once 'forum.php';
class cloud_api {
    function common() {
        global $_G;
        //判断是否缺少参数
        if (empty($_GET['ccid'])) {
            $variable = array(
                'code' => 1001,
                'messagestr' => lang('plugin/cloud', '1001'),
            );
            cloud_core::result(cloud_core::variable($variable));
        }
        $_FILES['Filedata']['name'] = addslashes(diconv(urldecode($_FILES['Filedata']['name']), 'UTF-8'));
        $_FILES['Filedata']['type'] = $_GET['filetype'];
        //初始化上传的文件信息
        $file = plugin_cloud::update_init($_FILES['Filedata'], 'product');

        //保存到指定的文件夹中
        plugin_cloud::saveUpload($file);

        //更新图片插入到数据库中
        $data = array(
            'iconUrl' => $file['attachment'],
            'lasttime' => TIMESTAMP,
        );
        $result = C::t('#cloud#cloud_category')->update($_GET['ccid'],$data);

        plugin_cloud::uploadMsg(0, $_GET['ccid']);
    }

    function output() { }


}
?>

